package com.zjff.mobiletwo.controller;

import com.zjff.mobiletwo.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin//跨域
@RestController//遵循RestFul
@RequestMapping("v2/Order/")
public class OrderController {
    @Autowired
    IOrderService orderService;

    @PutMapping("creat")
    public String create(Integer aid, Integer uid, String username, Integer[] cids) {
        String data = orderService.create(aid, uid, username, cids);
        return data;
    }
    @GetMapping("getOrderByUid")
    public String getOrderByUid(Integer uid){
        return orderService.getOrderByUid(uid);
    }
    @GetMapping("getOrderByOid")
    public String getOrderByOid(Integer oid){
        return orderService.getOrderByOid(oid);
    }
    @DeleteMapping("deleteByOid")
    public String deleteByOid(Integer oid) {
        return orderService.deleteByOid(oid);
    }
}
